<template>
  <div class="creativeNav">
    <div class="container">
      <div
        class="flexBox"
        v-for="(item, index) in routeList"
        :key="index"
        @click="handleClick(item)"
      >
        <!-- <div>
          <img :src="require('@/assets/images/carouselRight.png')" alt="" />
        </div> -->
        <div class="title" :class="{ isActive: $route.query.designCourseName == item.pageName }">
          {{ item.name }} ({{courseCount[item.pageName] || 0}})
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      routeList: [
        {
          name: "正在设计",
          pageName: "coursesList",
        },
        // 已提交与已发布合并
        // {
        //   name: "已经提交",
        //   pageName: "courseSubmitted",
        // },
        {
          name: "已经发布",
          pageName: "coursePublished",
        },
        // {
        //   name: "课程模板",
        //   pageName: "CourseTemplate",
        // },
        {
          name: "他人课程",
          pageName: "BrowseOtherCourse",
        },
        {
          name: "最近删除",
          pageName: "LatelyDelete",
        },
      ],
    };
  },
  props: {
    courseCount: Object
  },
  created() {
    if (this.$route.name == "Designcourse") this.handleClick(this.routeList[0])
  },
  methods: {
    handleClick(item) {
      const { name } = this.$route;
      this.$router.push({
        name: name,
        query: { designCourseName: item.pageName },
      });
    },
  },
};
</script>

<style lang="stylus">
.creativeNav {
  height: 84px;
  background-color: #ffffff;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.06);

  .container {
    padding: 0 0 10px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    max-width: 1200px;
    height: 100%;

    .flexBox {
      cursor pointer
      margin-right: 190px;
      display: flex;
      align-items: center;
      height: 27px;

      .title {
        margin-left: 5px;
        // font-family: PMingLiU-ExtB;
        font-size: 16px;
        color: #003262;
      }

      .isActive {
        position: relative;
        font-weight: bold;
      }

      .isActive::after {
        position: absolute;
        content: '';
        left: 50%;
        right: 50%;
        bottom: -5px;
        width: 60px;
        height: 2px;
        background: #003262;
        transform: translate(-50%, 0);
      }
    }

    a:last-child {
      .flexBox {
        margin-right: 0;
      }
    }

    @media only screen and (max-width: 767px) {
      .flexBox {
        margin-right: 60px;
      }
    }

    .rightBox {
      margin-left: 205px;
    }
  }
}
</style>